/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author WINDOWS 7
 */
@Entity
@Table(name = "costeo_articulo",catalog = "bdcotelasa", schema = "cotelasa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CosteoArticulo.findAll", query = "SELECT c FROM CosteoArticulo c"),
    @NamedQuery(name = "CosteoArticulo.findById", query = "SELECT c FROM CosteoArticulo c WHERE c.id = :id"),
    @NamedQuery(name = "CosteoArticulo.findByPartida", query = "SELECT c FROM CosteoArticulo c WHERE c.partida = :partida"),
    @NamedQuery(name = "CosteoArticulo.findByCantidad", query = "SELECT c FROM CosteoArticulo c WHERE c.cantidad = :cantidad"),
    @NamedQuery(name = "CosteoArticulo.findByTotal", query = "SELECT c FROM CosteoArticulo c WHERE c.total = :total"),
    @NamedQuery(name = "CosteoArticulo.findByFlete", query = "SELECT c FROM CosteoArticulo c WHERE c.flete = :flete"),
    @NamedQuery(name = "CosteoArticulo.findBySeguro", query = "SELECT c FROM CosteoArticulo c WHERE c.seguro = :seguro"),
    @NamedQuery(name = "CosteoArticulo.findByCif", query = "SELECT c FROM CosteoArticulo c WHERE c.cif = :cif"),
    @NamedQuery(name = "CosteoArticulo.findByPorcAdvalorem", query = "SELECT c FROM CosteoArticulo c WHERE c.porcAdvalorem = :porcAdvalorem"),
    @NamedQuery(name = "CosteoArticulo.findByValAdvalorem", query = "SELECT c FROM CosteoArticulo c WHERE c.valAdvalorem = :valAdvalorem"),
    @NamedQuery(name = "CosteoArticulo.findByAduana", query = "SELECT c FROM CosteoArticulo c WHERE c.aduana = :aduana"),
    @NamedQuery(name = "CosteoArticulo.findByOtro", query = "SELECT c FROM CosteoArticulo c WHERE c.otro = :otro"),
    @NamedQuery(name = "CosteoArticulo.findByGastoTotal", query = "SELECT c FROM CosteoArticulo c WHERE c.gastoTotal = :gastoTotal"),
    @NamedQuery(name = "CosteoArticulo.findByTotalImportacion", query = "SELECT c FROM CosteoArticulo c WHERE c.totalImportacion = :totalImportacion"),
    @NamedQuery(name = "CosteoArticulo.findByCostoUnitario", query = "SELECT c FROM CosteoArticulo c WHERE c.costoUnitario = :costoUnitario"),
    @NamedQuery(name = "CosteoArticulo.findByEstadoRegistro", query = "SELECT c FROM CosteoArticulo c WHERE c.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "CosteoArticulo.findByUsrCreacion", query = "SELECT c FROM CosteoArticulo c WHERE c.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "CosteoArticulo.findByFecCreacion", query = "SELECT c FROM CosteoArticulo c WHERE c.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "CosteoArticulo.findByUsrModificacion", query = "SELECT c FROM CosteoArticulo c WHERE c.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "CosteoArticulo.findByFecModificacion", query = "SELECT c FROM CosteoArticulo c WHERE c.fecModificacion = :fecModificacion")})
public class CosteoArticulo implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @SequenceGenerator(name = "generadorCosteoArticulo", sequenceName = "cotelasa.costeo_articulo_id_seq")
    @GeneratedValue(generator = "generadorCosteoArticulo")
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "partida")
    private String partida;
    
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad")
    private BigDecimal cantidad;
    @Basic(optional = false)
    @NotNull
    @Column(name = "total")
    private BigDecimal total;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "flete")
    private BigDecimal flete;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "seguro")
    private BigDecimal seguro;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "cif")
    private BigDecimal cif;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "porc_advalorem")
    private BigDecimal porcAdvalorem;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "val_advalorem")
    private BigDecimal valAdvalorem;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "aduana")
    private BigDecimal aduana;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "otro")
    private BigDecimal otro;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "gasto_total")
    private BigDecimal gastoTotal;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "total_importacion")
    private BigDecimal totalImportacion;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "costo_unitario")
    private BigDecimal costoUnitario;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Size(max = 20)
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @JoinColumn(name = "id_costeo_importacion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private CosteoImportacion idCosteoImportacion;
    
    @JoinColumn(name = "id_articulo", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Articulo idArticulo;

    public CosteoArticulo() {
    }

    public CosteoArticulo(Integer id) {
        this.id = id;
    }

    public CosteoArticulo(Integer id, String partida, BigDecimal cantidad, BigDecimal total, BigDecimal flete, BigDecimal seguro, BigDecimal cif, BigDecimal porcAdvalorem, BigDecimal valAdvalorem, BigDecimal aduana, BigDecimal otro, BigDecimal gastoTotal, BigDecimal totalImportacion, BigDecimal costoUnitario, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.partida = partida;
        this.cantidad = cantidad;
        this.total = total;
        this.flete = flete;
        this.seguro = seguro;
        this.cif = cif;
        this.porcAdvalorem = porcAdvalorem;
        this.valAdvalorem = valAdvalorem;
        this.aduana = aduana;
        this.otro = otro;
        this.gastoTotal = gastoTotal;
        this.totalImportacion = totalImportacion;
        this.costoUnitario = costoUnitario;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPartida() {
        return partida;
    }

    public void setPartida(String partida) {
        this.partida = partida;
    }

    public BigDecimal getCantidad() {
        return cantidad;
    }

    public void setCantidad(BigDecimal cantidad) {
        this.cantidad = cantidad;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public BigDecimal getFlete() {
        return flete;
    }

    public void setFlete(BigDecimal flete) {
        this.flete = flete;
    }

    public BigDecimal getSeguro() {
        return seguro;
    }

    public void setSeguro(BigDecimal seguro) {
        this.seguro = seguro;
    }

    public BigDecimal getCif() {
        return cif;
    }

    public void setCif(BigDecimal cif) {
        this.cif = cif;
    }

    public BigDecimal getPorcAdvalorem() {
        return porcAdvalorem;
    }

    public void setPorcAdvalorem(BigDecimal porcAdvalorem) {
        this.porcAdvalorem = porcAdvalorem;
    }

    public BigDecimal getValAdvalorem() {
        return valAdvalorem;
    }

    public void setValAdvalorem(BigDecimal valAdvalorem) {
        this.valAdvalorem = valAdvalorem;
    }

    public BigDecimal getAduana() {
        return aduana;
    }

    public void setAduana(BigDecimal aduana) {
        this.aduana = aduana;
    }

    public BigDecimal getOtro() {
        return otro;
    }

    public void setOtro(BigDecimal otro) {
        this.otro = otro;
    }

    public BigDecimal getGastoTotal() {
        return gastoTotal;
    }

    public void setGastoTotal(BigDecimal gastoTotal) {
        this.gastoTotal = gastoTotal;
    }

    public BigDecimal getTotalImportacion() {
        return totalImportacion;
    }

    public void setTotalImportacion(BigDecimal totalImportacion) {
        this.totalImportacion = totalImportacion;
    }

    public BigDecimal getCostoUnitario() {
        return costoUnitario;
    }

    public void setCostoUnitario(BigDecimal costoUnitario) {
        this.costoUnitario = costoUnitario;
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public CosteoImportacion getIdCosteoImportacion() {
        return idCosteoImportacion;
    }

    public void setIdCosteoImportacion(CosteoImportacion idCosteoImportacion) {
        this.idCosteoImportacion = idCosteoImportacion;
    }

    public Articulo getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Articulo idArticulo) {
        this.idArticulo = idArticulo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CosteoArticulo)) {
            return false;
        }
        CosteoArticulo other = (CosteoArticulo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.com.cotelasa.scp.entidad.CosteoArticulo[ id=" + id + " ]";
    }
    
}
